package agencyAuto;

import agency.GamePlayer;
import agency.GamePlayerProxy;
import agency.IGamePlayer;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 * @author CC小天才
 * @website www.flyskill.cn
 * @date 2021/10/6 16:25
 **/

public class Client {
    public static void  main(String []args){
        IGamePlayer player=new GamePlayer("cc");

        InvocationHandler invocationHandler=new GamePlayIH(player);

        ClassLoader classLoader=player.getClass().getClassLoader();

        IGamePlayer gamePlayer= (IGamePlayer) Proxy.newProxyInstance(classLoader,new Class[]{IGamePlayer.class},invocationHandler);

        gamePlayer.login("cc","666");
        gamePlayer.killBoss();
        gamePlayer.upgrade();

    }

}
